import java.util.Iterator;

/**
 * Created with IntelliJ IDEA.
 * User: valera
 * Date: 14.02.14
 * Time: 13:33
 */
public class Subset {
    private static RandomizedQueue<String> queue;

    public static void main(String[] args) {
        int k = Integer.parseInt(args[0]);
        queue = new RandomizedQueue<String>();
        String tmpStr = "";
        int i = 0;
        while (tmpStr != null && i < k) {
            tmpStr = StdIn.readString();
            if (tmpStr != null) {
                queue.enqueue(tmpStr);
            }
        }
        Iterator<String> iter = queue.iterator();
        while (iter.hasNext()) {
            System.out.println(iter.next());
        }
    }
}
